﻿

@{
    
}

<!-- BEGIN LOGIN -->
<h3></h3>
<div class="portlet-body form">
    <!-- BEGIN FORM-->
    <div class="pass">
        <div class="pass_tit font-yellow-casablanca"><i class="fa fa-exclamation-triangle"></i> 修改密码</div>
        
            <form action="" class="form-horizontal" method="post">
                <div class="form-body">
                    <div class="form-group">
                        <label class="control-label col-md-3">
                            输入新密码<span class="required"> * </span>
                        </label>
                        <div class="col-md-6" style="width:45%">
                            @*@Html.PasswordFor(l => l.Password, new { @placeholder = "输入新密码", @class = "form-control", @autocomplete = "off" })*@
                            <input type="password" id="Password" name="Password" placeholder="输入新密码" class="form-control" autocomplete="off" />
                        </div>
                        <p class="waring" id="pwdmsg"></p>

                    </div>
                    <div class="form-group">
                        <label class="control-label col-md-3">
                            输入确认密码<span class="required"> * </span>
                        </label>
                        <div class="col-md-6" style="width:45%">
                            @*@Html.PasswordFor(l => l.ConfirmPassword, new { @placeholder = "输入确认密码", @class = "form-control", @autocomplete = "off" })*@
                            <input type="password" id="confirmpwd" name="confirmpwd" placeholder="输入确认密码" class="form-control" autocomplete="off" />
                        </div>
                        <p class="waring" id="confirmpwdmsg"></p>

                    </div>
                    <div class="row pss_but">
                        <div class="col-md-offset-4 col-md-8">
                            <button type="button" class="btn btn-primary"  onclick="ChangePwd();"><span class="glyphicon glyphicon-ok"> </span> 提交</button>
                            <button type="button" class="btn default" data-dismiss="modal" aria-hidden="true" onclick=""><span class="glyphicon glyphicon-remove"> </span> 取消</button>
                        </div>
                    </div>
                </div>
            </form>
    </div>
</div>
    
<script type="text/javascript">
    // 保存成功触发的事件
    function ChangePwd() {
        var pwd = $("#Password").val();
        if (pwd == "") {
            $("#pwdmsg").text("密码不能为空");
            return false;
        } else {
            $("#pwdmsg").text("");
        }
        var cpwd = $("#confirmpwd").val();
        if (cpwd == "") {
            $("#confirmpwdmsg").text("请确认密码");
            return false;
        } else {
            $("#confirmpwdmsg").text("");
        }
        if (pwd != cpwd) {
            $("#confirmpwdmsg").text("两次输入的密码不一致");
            return false;
        } else {
            $("#confirmpwdmsg").text("");
        }
        $.ajax({
            url: "/Home/ModifyPwdOn",
            type: "post",
            data: { pwd: pwd },
            success: function (result) {
                if (result.success) {
                    window.location.reload();
                }
            }
        });
    }
</script>